package net.lab1024.sa.admin.module.business.tx.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.admin.module.business.order.domain.vo.OrderVO;
import net.lab1024.sa.admin.module.business.tx.domain.form.TxAddForm;
import net.lab1024.sa.admin.module.business.tx.domain.form.TxQueryForm;
import net.lab1024.sa.admin.module.business.tx.domain.form.TxUpdateForm;
import net.lab1024.sa.admin.module.business.tx.domain.vo.TxVO;
import net.lab1024.sa.admin.module.business.tx.service.TxService;
import net.lab1024.sa.admin.module.system.user.domain.JdyVO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 提现申请表 Controller
 *
 * @Author syf
 * @Date 2025-05-28 10:25:38
 * @Copyright 畅想科技
 */

@RestController
@Tag(name = "")
public class TxController {

    @Resource
    private TxService txService;

    @Operation(summary = "分页查询 @author syf")
    @PostMapping("/tx/queryPage")
    public ResponseDTO<PageResult<TxVO>> queryPage(@RequestBody @Valid TxQueryForm queryForm) {
        return ResponseDTO.ok(txService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author syf")
    @PostMapping("/tx/add")
    public ResponseDTO<String> add(@RequestBody @Valid TxAddForm addForm) {
        return txService.add(addForm);
    }

    @Operation(summary = "更新 @author syf")
    @PostMapping("/tx/update")
    public ResponseDTO<String> update(@RequestBody @Valid TxUpdateForm updateForm) {
        return txService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author syf")
    @PostMapping("/tx/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return txService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author syf")
    @GetMapping("/tx/delete/{txId}")
    public ResponseDTO<String> batchDelete(@PathVariable Long txId) {
        return txService.delete(txId);
    }
    @Operation(summary = "单个删除 @author syf")
    @GetMapping("/tx/detail/{userId}")
    public ResponseDTO<JdyVO> detail(@PathVariable @Valid String userId) {
        return txService.detail(userId);
    }
    @Operation(summary = "单个删除 @author syf")
    @GetMapping("/tx/userDetail/{userId}")
    public ResponseDTO<TxVO> userDetail(@PathVariable @Valid String userId) {
        return txService.userDetail(userId);
    }
}
